var app = getApp();
Page({
    data:{
        inited : false,
        sharedata : {},
		siteroot : app.siteInfo.siteroot.replace('app/index.php', ''),uniacid: app.siteInfo.uniacid,
    },
    onShow(){
        if(this.data.inited){
            app.com.backPage(0);
        }
    },
    onLoad:function(options){
        var self = this;
        var id = options.id ? options.id : '';
        id = options.scene ? options.scene : id;

        var zfid = options.zfid ? options.zfid : '';
        app.com.http('wxlive','POST',{op:'info',id:id,zfid:zfid},0,false,'','',function(res){
            if (!res.data.errno && res.data) {
                self.data.inited = true;
                let roomId = res.data.data.roomid;
                let customParams = { zfid: zfid };
                wx.navigateTo({
                    url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${roomId}&custom_params=${encodeURIComponent(JSON.stringify(customParams))}`
                })
            }else{
                app.com.alert(res.data.message,function(){
                    app.com.backPage(0);
                });
            }
        });
    },
    
})